<!-- 自定义用户输入(编号、账号)  -->
<template>
    <input-with-helper showLabel v-bind="$attrs" v-on="$listeners" v-model="childValue" dialogTitle="选择岗位"
        dialogWidth="600px" :searchCriteria="[
            { label: '岗位名称', prop: 'postName' },
            { label: '学生姓名', prop: 'stuName' },
            { label: '学号', prop: 'stuNo' },
        ]" :columns="[
            { title: '岗位名称', field: 'postName', sortable: true },
            { title: '学号', field: 'stuNo', sortable: true },
            { title: '学生姓名', field: 'stuName', sortable: true },
        ]" :defaultSort="{
            field: 'id',
            order: 'asc',
        }" :searchMethod="getList" :valueProps="valueProps">
    </input-with-helper>
</template>

<script>
import { listAllCanSelectPost as getList } from "@/api/workstudy/stuPost";
import InputWithHelper from "@/components/ValueHelper/index";

export default {
    name: "StuOwnPostSelect",
    components: {
        InputWithHelper,
    },
    props: {
        value: null,
        valueProps: {
            type: Object,
            default: () => {
                return {
                    value: "id",
                    label: "stuName",
                };
            },
        },
    },
    data() {
        return {
            //选择值
            childValue: this.value,
        };
    },
    watch: {
        //父组件值变更
        value(val) {
            this.childValue = val;
        },
    },
    methods: {
        getList,
    },
};
</script>